home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
501-525
/
apd520
/
asstd_programs
/
city square.amos
/
city square.amosSourceCode
Wrap
AMOS Source Code
|
1991-01-15
|
756b
|
38 lines
' CITY SQUARE
' A simple routine that uses recursion.
' Robert Farnsworth.
'
' Speed Comparison: (before I AMOSed it)
' GFA Basic - 17.8 sec
' AMOS1.2 - 14.6 sec
' AmigaBasic - NA (Can't do recursion)
'
Screen Open 0,640,256,4,Hires
Colour 0,$EAF
Flash Off : Curs Off : Cls 0
'
S=Timer
GRID[320,128,400,6]
Print(Timer-S)/50.0
End
'
Procedure GRID[X,Y,S,L]
If L>0
SQUARE[X,Y,S]
' top left
GRID[X-S/4,Y-S/8,S/2-4,L-1]
' top right
GRID[X+S/4,Y-S/8,S/2-4,L-1]
' bottom left
GRID[X-S/4,Y+S/8,S/2-4,L-1]
' bottom right
GRID[X+S/4,Y+S/8,S/2-4,L-1]
End If
End Proc
'
Procedure SQUARE[X,Y,SIDE]
Shared C
Add C,1,1 To 3
Ink C
Box X-SIDE/2,Y-SIDE/4 To X+SIDE/2,Y+SIDE/4
End Proc